<?php
/**
 * 兼容第三方插件补丁文件
 * @来自第三方接口文件
 */
 defined('BY_JYA') or exit('error');
require_once($this->plugin_root .'/alisms/sms.php');

list($mobile,$content,$mid,$pluginname)=$arguments;
$setting=$this->get_Setting();
if(!$setting['appkey'] || !$setting['secret']){
	return error('参数错误');
}
$islog=pdo_getcolumn('jy_alisms_dayu_log',array('mb_id'=>$mb_id,'mobile'=>$mobile,'createtime >='=>time()-600),'id');
if($islog){
	return error('请勿频繁获取验证码！');
}
$logtimes=pdo_count('jy_alisms_dayu_log',array('mb_id'=>$mb_id,'uniacid'=>$_SESSION['uniacid'],'createtime >='=>time()-3600),'id');
if($logtimes>=10){
	return error('请勿频繁获取验证码！');
}
$appkey=$setting['appkey'];
$secret=$setting['secret'];
$sign=$setting['sign'];
$content=$content?ijson_encode($content):'{}';
$return=sendsmsnew($appkey,$secret,$mobile,$sign,$mid,$content);
$return=(array)$return;
if($return['Code']=='OK'){
	$status=1;
}else{
	$status=0;
}
if(!$pluginname){
	$pluginname='core';
}
$data=array(
	'uniacid'=>$_SESSION['uniacid'],
	'plugin'=>$pluginname,
	'mb_id'=>$mid,
	'status'=>$status,
	'remake'=>$return['Message'],
	'createtime'=>time(),
	'mobile'=>$mobile,
);
$this->insert('dayu_log',$data);
if($status==0){
	return error($return['Message']);
}
return $status;
